<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>
    <style>

    *{
    margin: 0;
    padding: 0;
}
html,body{
    width: 100%;
    height: 100%;
}
#app{
    width:100%;
    /*height: 100%;*/
    background: url(../../image/3_bg.png) center center no-repeat;
    background-size: cover;
    background-repeat:no-repeat;
    -moz-background-size: 100% 100%;
    padding-bottom: 30px;
}
.aui-bar-btn-item{
  border-color: #ffffff;
  background: #f7f4f2
}

    </style>
</head>
<body style="height:100%">
<div id="app" class="container"  v-cloak style="height:100%">
  <div class="pasture-main" >
    <div class="pasture-top" >
      <div class="pasture-assets"  style="width:100%;font-size:0px;">
        <div class="my-level" v-open-win vurl="../user/mycoupon">
          <img v-src="'../../image/3_quan.png'">
          <span style="color:#FF504D">{{nFormatter(user.voucher,2)}}</span>
        </div>
        <div class="my-coins"   v-myclick="opencoins">
          <img v-src="'../../image/3_jinbi.png'">
          <span style="color:#FFAF53">{{nFormatter(user.gold,2)}}</span>

        </div>
        <div class="my-prestige"  v-myclick="prestige">
          <img v-src="'../../image/3_shengwang.png'">
          <span style="color:#3ACCC7">{{nFormatter(user.renown,2)}}</span>

        </div>
        <div class="my-question" style="width:7%;margin-left:18px" v-myclick="help">
          <img v-src="'../../image/3_bangzu.png'" style="width:21px;margin-right:0px">
        </div>

      </div>
      <div class="pasture-user" style="position:absolute;top:6%;z-index:1">
        <div class="user-avatar" ><img :src="user.portrait"></div>
        <div class="user-level" >
          <div class="level-name" >等级：{{user.name}}</div>
          <div class="level-pic">
            <img :src="user.level_id>1?'../../image/big/level1.png':'../../image/big/level0.png'">
            <img :src="user.level_id>2?'../../image/big/level2.png':'../../image/big/level0.png'">
            <img :src="user.level_id>3?'../../image/big/level3.png':'../../image/big/level0.png'">
            <img :src="user.level_id>4?'../../image/big/level4.png':'../../image/big/level0.png'">
            <img :src="user.level_id>5?'../../image/big/level5.png':'../../image/big/level0.png'">
          </div>
        </div>
        <div style="clear:both"></div>
      </div>
    </div>
    <div class="pasture-run"  style="position:absolute;top:7%;">
      <img src="../../image/yun_gif.gif" width="100%" >
    </div>
    <div class="pasture-foot">
      <div class="foot-left" >
        <img v-src="'../../image/3_6sc.png'">
        <div class="shicao">
          <div class="shicao_pre" :style="getpre(user.milk,10)"></div>
        </div>
        <div class="shicao_key">{{user.milk}}/10</div>
      </div>
      <div class="foot-right" >
        <div v-myclick="shengji">
          <img v-src="'../../image/3_sj_1.png'" v-show="user.calf>0&&user.milk>=10">
          <img v-src="'../../image/3_sj_2.png'" v-show="user.calf<=0||user.milk<10">

        </div>
        <div style="margin-top:5px" v-show="user.calf>0&&user.milk>=10">有{{user.calf}}头小牛可以升级为奶牛</div>
        <div style="margin-top:5px" v-show="user.calf<=0">您还没有小牛</div>
        <div style="margin-top:5px" v-show="user.calf>0&&user.milk<10">牛奶不足</div>

      </div>
    </div>
    <div class="pasture-middle">
      <div class="pasture-pets">
        <div class="pets-property">小牛</div>
        <div class="pets-pic"><img v-src="'../../image/3_xiaoniu.png'"></div>
        <div class="pets-count">{{user.calf}}头</div>

      </div>
      <div class="pasture-pets">
        <div class="pets-property">奶牛</div>
        <div class="pets-pic"><img v-src="'../../image/3_daniu.png'"></div>
        <div class="pets-count">{{user.cow}}头</div>

      </div>
      <div class="pasture-pets">
        <div class="pets-property">天堂牛</div>
        <div class="pets-pic"><img v-src="'../../image/3_tiantangniu.png'"></div>
        <div class="pets-property">{{user.godcow}}头</div>

      </div>
    </div>
    <div class="aui-mask aui-mask-in" v-show="modal" style="z-index:2"></div>

    <div class="alert_modal" v-show="modal">
      <div class="cangku modal-container" v-show="showtype==1">
        <div class="my-store">
          <div ><img v-src="'../../image/3_milk.png'" style="width:60px;margin:0 auto"></div>
          <div style="text-align:center">原产奶</div>
        </div>
        <div class="modallogo"><img  v-src="'../../image/title_changku.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[1, showmodal]">
        <div class="sum">{{user.product_milk}}桶</div>
        <div class="modalbutton" v-myclick="opendshop">
          <img v-src="'../../image/anniu_3.png'" >
          <span>出售</span>
        </div>
      </div>
      <div class="jishi modal-container" v-show="showtype==0">
        <div class="my-store">
          <div ><img v-src="'../../image/3_xiaoniu.png'" style="width:60px;margin:0 auto"></div>
          <div style="text-align:center">小牛</div>
        </div>
        <div class="modallogo"><img  v-src="'../../image/title_jishi.png'"></div>
        <div class="sum">
          <img v-src="'../../image/3_jinbi2.png'" />
          <span>100金币/头</span>
        </div>
          <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[0, showmodal]">
          <div class="aui-bar aui-bar-btn modal_check" type="count" id="demo" style="width:50%">
            <div class="aui-bar-btn-item aui-font-size-20" v-myclick="[0, changecount]" style="width:60px">
                <i class="aui-iconfont aui-icon-minus" style="font-weight:800"></i>
            </div>
            <div class="aui-bar-btn-item" style="width:120px;">
                <input type ="number"  pattern="[0-9]*" min="1" max="1000" class="aui-input aui-text-center" v-model="count" width="120px" >
            </div>
            <div class="aui-bar-btn-item aui-font-size-20 " v-myclick="[1, changecount]" style="width:60px">
                  <i class="aui-iconfont aui-icon-plus" style="font-weight:800"></i>
              </div>
          </div>
          <div class="total_price">共{{total_coins}}金币</div>
        <div class="modalbutton" v-myclick="buyProp">
          <img v-src="'../../image/anniu_3.png'" >
          <span>购买</span>
        </div>
      </div>
      <div class="cangku modal-container" v-show="showtype==2">
        <div class="my-store" style="background-color:#FBDFDD">
          <div ><img v-src="'../../image/3_tiantangniu.png'" style="width:60px;margin:0 auto"></div>
          <div style="text-align:center">天堂牛</div>
        </div>
        <div class="modallogo"><img v-src="'../../image/title_jitan.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[2, showmodal]">

        <div class="sum">{{user.godcow}}头</div>
        <div class="total_price">每头天堂牛献祭可获得50金币</div>

        <div class="modalbutton" v-myclick="sacrifice">
          <img v-src="'../../image/anniu_3.png'" v-show="user.godcow>0">
          <img v-src="'../../image/anniu_1.png'" v-show="user.godcow<=0">
          <span>全部献祭</span>
        </div>
      </div>
      <div class="qiandao modal-container" v-show="showtype==3">
        <div class="modallogo"><img v-src="'../../image/title_huodong4.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[3, showmodal]">
        <div class="my-qiandao">
          <div class="qiandao_crad" >
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('1')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('1')==-1">
            <div class="card-top">第1天</div>
            <div class="card-coins">10金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('2')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('2')==-1">
            <div class="card-top">第2天</div>
            <div class="card-coins">10金币</div>
          </div>
          <div class="qiandao_crad qianactive">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('3')>-1">
            <img    v-src="'../../image/bg_qiandao2.png'" v-show="signarr.indexOf('3')==-1">
            <div class="card-top">第3天</div>
            <div class="card-coins">40金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('4')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('4')==-1">
            <div class="card-top">第4天</div>
            <div class="card-coins">10金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('5')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('5')==-1">
            <div class="card-top">第5天</div>
            <div class="card-coins">10金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('6')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('6')==-1">
            <div class="card-top">第6天</div>
            <div class="card-coins">10金币</div>
          </div>
          <div class="qiandao_crad qianactive">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('7')>-1">
            <img    v-src="'../../image/bg_qiandao2.png'" v-show="signarr.indexOf('7')==-1">
            <div class="card-top">第7天</div>
            <div class="card-coins">100金币</div>
          </div>
        </div>
        <div class="total_price" style="top:235px">连续签到的第3天和第7天可获得大量金币</div>
        <div class="modalbutton" style="bottom:15px" v-myclick="qiandao">
          <img v-src="'../../image/anniu_3.png'" v-show="signinfo.is_sign!=1">
          <img v-src="'../../image/anniu_1.png'"  v-show="signinfo.is_sign==1">
          <span>{{signinfo.is_sign==1?"已签到":'签到'}}</span>
        </div>
      </div>
      <div class="jiahua modal-container" v-show="showtype==4">
        <div class="modallogo"><img v-src="'../../image/title_huodong1.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[4, showmodal]">

        <div style="margin-top:20px;"><img src="../../image/33jihua_1.png" style="width:90%;margin:0 auto;"></div>

        <div style="width:70%;margin:0 auto;margin-top:30px;font-size:12px" v-show="planinfo!=''">我们将在8月12日上午06:00公布你的获奖情况，敬请期待</div>
        <div class="modalbutton"  v-show="planinfo==''" v-myclick="joinPlan">我要参与</div>
      </div>
      <div class="dhzl modal-container" v-show="showtype==5">
        <div class="modallogo"><img v-src="'../../image/title_huodong3.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[5, showmodal]">

        <div style="margin-top:15px;"><img src="../../image/dahengzhilu_1.png" style="width:85%;margin:0 auto"></div>
        <div class="submembers" style="text-align:center;margin-top:2%">
          <img width="40px" style="margin:0 auto;display:inline-block;padding:3px" :src="item_one" v-for="(item_one, index) in type2_list">
        </div>
        <div class="modalbutton" style="bottom:2%"  v-myclick="['session',share_wx]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>分享我的邀请链接</span>
        </div>
      </div>
      <div class="dhzl modal-container" v-show="showtype==6">
        <div class="modallogo"><img v-src="'../../image/title_huodong2.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[6, showmodal]">

        <div style="margin-top:15px;position:relative">
          <img src="../../image/huangjinmumin_1.png" style="width:85%;margin:0 auto;">
          <div class="mumin">
            <div class="mumin_pre" :style="getpre(GoldLevel2Count,4999)"></div>
          </div>
          <div class="mumin_key">{{GoldLevel2Count}}/4999</div>
        </div>
        <div class="submembers" style="text-align:center;margin-top:2%">
          <img width="40px" style="margin:0 auto;display:inline-block;padding:3px" :src="item_one" v-for="(item_one, index) in type3_list">
        </div>
        <div class="modalbutton" style="bottom:2%" v-myclick="['session',share_wx]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>分享我的邀请链接</span>
        </div>
      </div>
      <div class="shengji modal-container" v-show="showtype==7">
        <div class="modallogo"><img  v-src="'../../image/success_1.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[7, showmodal]">
        <div class="desc" style="margin:20px">你已经成功将一头小牛升级为奶牛了，获得1桶原产奶</div>
        <div class="shengji_content" style="text-align:center">
          <img v-src="'../../image/3_milk.png'" style="margin:0 auto;">
          <div style="margin-top:20px">原产奶×1</div>
        </div>
        <div class="modalbutton" v-myclick="[7, showmodal]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>太棒了</span>
        </div>
      </div>
    </div>
    <div class="pasture-nav">
      <img v-src="'../../image/3_2js.png'" v-myclick="[0, showmodal]">
      <img v-src="'../../image/3_1ck.png'" v-myclick="[1, showmodal]">
      <img v-src="'../../image/3_4jt.png'" v-myclick="[2, showmodal]">
      <img v-src="'../../image/3_3jy.png'" v-myclick="opendshop">
    </div>
    <div class="pasture-more" >
      <div class="more-right" v-myclick="more">
        <img src="../../image/zhankai.png" v-show="showmore">
        <img src="../../image/suojin.png" v-show="!showmore">
      </div>
      <div class="more-left" v-show="showmore">
        <img src="../../image/linchang.png">
        <img src="../../image/nongchang.png">
        <img src="../../image/yuchang.png" style="padding-bottom:5px">
      </div>
    </div>
    <div class="pasture-activity">
      <div class="activity-left" v-show="showactivity">
        <img src="../../image/meiriqiandao.png" v-myclick="[3, showmodal]">
        <img src="../../image/huangjinmumin.png" v-myclick="[6, showmodal]">
        <img src="../../image/dahengzhilu.png" v-myclick="[5, showmodal]">
        <img src="../../image/33jihua.png" v-myclick="[4, showmodal]" style="padding-bottom:5px">
      </div>
      <div class="activity-right" v-myclick="activity" >
        <img src="../../image/huodong.png">
      </div>
    </div>
  </div>

</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/aui-sharebox.js" ></script>
<script src="../../script/aui_api.js"></script>

<script src="../../script/aui-tab.js" ></script>
<script>

    var user,
        qrcode,
        scanner,
        wx,
        qq,
        clipBoard,
        wap_url,
        vm;

    var mq;
    apiready = function () {
        setBSImg();
        scanner = api.require('FNScanner');
        wx = api.require('wx');
        qq = api.require('QQPlus');
        wap_url = getPrefs("wap_url");
        MNActionButton = api.require('MNActionButton');
        clipBoard = api.require('clipBoard');
        mq = api.require('meiQia');
        showProgress();
        var data = {
            member_id: getPrefs('member_id')
        };
        var callback = function (ret) {
            user = ret.content;
            console.log(JSON.stringify(user))
            initApp();
        };
        pinet.post(URL.getUserinfo, data, callback);
        addListeners();
        api.parseTapmode();
    };
    function openSharebox(){
      var sharebox = new auiSharebox();
    sharebox.init({
        frameBounces:true,//当前页面是否弹动，（主要针对安卓端）
        buttons:[
          {
            image:'../../image/iconfont-weixin.png',
            text:'微信',
            value:'wx'//可选
        }
      ],
        col:5,
        cancelTitle:'取消'//可选,当然也可以采用下面的方式使用图标
        // cancelTitle:'<i class="aui-iconfont aui-icon-close aui-font-size-16"></i>'//可选
    },function(ret){
        if(ret){
          buttonValue = ret.buttonValue;
          switch (buttonValue) {
            case 'wx':
            vm.share_wx('session');
            case 'wx-circle':
            vm.share_wx('timeline');
            case 'qq':
            vm.share_qq();
              break;
            default:

          }
        }
    })
}

    function initApp() {
        vm = new Vue({
            el: '#app',
            data: {
                user: user,
                modal:false,
                showtype:1,
                count:1,
                showactivity:false,
                showmore:false,
                signinfo:'',
                signarr:[],
                planinfo:'',
                wap_url: wap_url,

                imgPath: '../../image/',
                total_coins:100,
                is_sign:false,
                appInstalled: {
                    wx: true,
                    qq: true,
                },
                BSImg: {
                    big: Vue.BSImg == 'big',
                    small: Vue.BSImg == 'small',
                },
                invite_list:[],
                type2_list:[],
                type3_list:[],
                GoldLevel2Count:0,
            },
            mounted:function(){
              this.qiandaoinfo();
              this.plan();
              this.getGoldLevelRecord();
              this.getGoldLevel2Count();

            },

            methods: {
              verifyNumber:function(){
                if(this.count <= 0){
                  this.count = 1
                }else if (this.count > 1000) {
                  this.count = 1000
                }
                this.count = Math.round(this.count)
              },
              showmodal:function (id) {
                this.showtype = id;
                if(this.showactivity){
                  this.showactivity = false;
                }else{
                  this.modal = !this.modal;
                }

              },
              opencoins:function(){
                openWin("../game/mycoins");
              },
              prestige:function () {
                openWin("../game/prestige");
              },
              reload(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                    vm.user = ret.content;
                    setPrefs('username', user.nickname);
                    setPrefs('portrait', user.portrait);
                    setPrefs('level_id', user.level_id);
                };
                pinet.post(URL.getUserinfo, data, callback);
              },
              getpre: function (count,total) {
                return {
                    width:(count<=total?count/total*100+"%":'100%')
                };
            },
              joinPlan:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '参与成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.planinfo = 1;

                };
                pinet.post(URL.joinPlan, data, callback);
              },
              qiandaoinfo(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                    vm.signinfo = ret.content;
                    if(ret.content.mark!=''){
                      vm.signarr = vm.signinfo.mark.split(",").map(parseFloat);
                    }
                };
                pinet.post(URL.getSignInfo, data, callback);
              },
              getGoldLevel2Count(){
                var data = {
                    member_id: getPrefs('member_id'),
                };
                var callback = function (ret) {
                  vm.GoldLevel2Count = ret.content;
                };
                pinet.post(URL.getGoldLevel2Count, data, callback);
              },
              getGoldLevelRecord(){
                var data = {
                    member_id: getPrefs('member_id'),
                };
                var callback = function (ret) {
                  var invite_list = ret.content
                  var type2_list = invite_list.gold_l2_list;
                  var type3_list = invite_list.gold_l3_list;
                  for (var i = 0; i < 3; i++) {
                    vm.type2_list[i] = type2_list[i]?type2_list[i].portrait:'../../image/default_member.png'
                  }
                  for (var j = 0; j < 5; j++) {
                    vm.type3_list[j] = type2_list[j]?type2_list[j].portrait:'../../image/default_member.png'
                  }
                  vm.invite_list = ret.content;
                };
                pinet.post(URL.getGoldLevelRecord, data, callback);
              },
              buyProp(){
                var data = {
                    member_id: getPrefs('member_id'),
                    prop_id:3,
                    num:this.count
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '购买成功',
                    duration : 3000,
                    location : 'middle'
                  });

                  vm.reload();


                };
                pinet.post(URL.buyProp, data, callback)
              },
              plan:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  vm.planinfo = ret.content;
                };
                pinet.post(URL.getThreePlanInfo, data, callback)
              },
              opendshop:function(){
                var url = "http://yima882.com/buy.html?member_id="+getPrefs('member_id')+"&token="+getPrefs('token');
                openWin("../game/yima",{url: url});
              },
              qiandao:function () {
                var days_sign = vm.signarr.length>0?parseInt(vm.signarr.slice(-1))+parseInt(1):1;
                var data = {
                    member_id: getPrefs('member_id'),
                    days:days_sign>7?1:days_sign
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '签到成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.qiandaoinfo();
                  vm.reload();

                  vm.signinfo.is_sign= 1;
                };
                pinet.post(URL.sign, data, callback);
              },
              sacrifice:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '献祭成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.reload();
                };
                pinet.post(URL.sacrifice, data, callback);
              },
              share_wx: function (scene) {
                 var that = this;
                  if(!that.appInstalled.wx){
                    api.alert({
                        title: '提示',
                        msg: '未能检测到本地微信',
                        buttons: ['确定']
                    }, function (ret, err) {});
                  }else{
                    share_wx(scene, vm.user.share);
                  }
              },
              shengji:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '升级成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.showtype = 7;
                  vm.modal = !vm.modal;
                  vm.reload();
                };
                pinet.post(URL.growUp, data, callback);
              },
              more:function(){
                var z_index = this.showmore?0:66;
                $api.css($api.dom('.pasture-more'), 'z-index: '+z_index);
                this.showtype = -1;
                this.showmore=!this.showmore;
                this.modal =  !this.modal;
              },
              activity:function(){
                var z_index = this.showactivity?0:66;
                $api.css($api.dom('.pasture-activity'), 'z-index: '+z_index);
                this.showtype = -1;
                this.showactivity=!this.showactivity;
                this.modal =  !this.modal;

              },
              changecount:function (type) {
                if(type==1){
                  this.count= parseInt(this.count)+1;
                }
                if(type==0&&this.count>1){
                  this.count=parseInt(this.count)-1;
                }
                // this.total_coins = this.count*100;
              },
              help: function () {
                  var url = this.wap_url + 'home/helpword';
                  console.log(url);
                  openWin('../home/browser', {url: url});
              }
            },
            created: function () {
                var that = this;
                wx.isInstalled(function (ret) {
                    that.appInstalled.wx = ret.installed;
                });
                qq.installed(function (ret) {
                    that.appInstalled.qq = ret.status;
                });
            },
            // beforeUpdate(){
            //     this.verifyNumber()
            // },
            watch:{
              count: function (newVaL) {
                this.total_coins = this.count*100;
                this.verifyNumber()
              },
            },
        })
    }

    function nFormatter(num, digits) {
               var si = [
                   { value: 1, symbol: "" },
                   { value: 1E3, symbol: "K" },
                   { value: 1E6, symbol: "M" },
                   { value: 1E9, symbol: "G" },
                   { value: 1E12, symbol: "T" },
                   { value: 1E15, symbol: "P" },
                   { value: 1E18, symbol: "E" }
               ];
               var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
               var i;
               for (i = si.length - 1; i > 0; i--) {
                   if (num >= si[i].value) {
                       break;
                   }
               }
               return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
           }



    function addListeners() {

        api.addEventListener({
            name: 'viewappear'
        }, function (ret, err) {
        });
        api.addEventListener({
            name: 'updateproperty'
        }, function (ret, err) {
          var data = {
              member_id: getPrefs('member_id')
          };
          var callback = function (ret) {
              vm.user = ret.content;
          };
          pinet.post(URL.getUserinfo, data, callback);
        });
    }


</script>
</html>
